<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'AddProductType.jsp' starting page</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
	<link href="<%=path%>/css/mine.css" type="text/css" rel="stylesheet">
    <link href="<%=path%>/css/custom.css" type="text/css" rel="stylesheet">
	<script type="text/javascript" src="<%=path%>/js/jquery-1.6.2.min.js"></script>
	<script type="text/javascript">
	function myajax(){
		  var url = '<%=path%>/Product_AddType1';
		$.ajax({
				cache: true,
				type: 'POST',
				url:url,
				data:$('#myform1').serialize(),	 
				async: false,
				error: function(request) {
				alert("发送请求失败！"+request.responseText);
				},
				success: function(data) {
				//alert(data);
				
				//window.frames["update_frame_name"].mainMyformSubmit();
				alert("添加成功");
				$(location).attr('href','<%=path%>/Product_QueryType1'); 
				
				}
				});
		}
	
	function myajax2(){
		  var url = '<%=path%>/Product_AddType2';
		$.ajax({
				cache: true,
				type: 'POST',
				url:url,
				data:$('#myform2').serialize(),	 
				async: false,
				error: function(request) {
				alert("发送请求失败！"+request.responseText);
				},
				success: function(data) {
				//alert(data);
				
				//window.frames["update_frame_name"].mainMyformSubmit();
				alert("保存成功");
				$(location).attr('href','<%=path%>/Product_QueryType1'); 
				}
				});
		}
	
	</script>

  </head>
  
  <body>
  <div class="div_head">
		<span> <span style="float:left">当前位置是：产品管理 》 添加产品类别</span> <span
			style="float:right;margin-right: 8px;font-weight: bold"> <a
				style="text-decoration: none" href="./admin.php?c=goods&a=showlist">【主页】</a>
		</span>
		</span>
	</div>
  <div>
   <form id="myform1" method="post" >
  <table id="kk" cellSpacing="0" cellPadding="2"
		width="100%" bgColor="#ffffff" border="2">
		<tr>
		  <th scope="col" abbr="Dual 1.8">添加类型</th>
		  <th scope="col" abbr="Dual 1.8">产品类别名称</th>
		  <th scope="col" abbr="Dual 1.8">产品类别名称（英文）</th>
		  <th scope="col" abbr="Dual 1.8">描述</th>
		</tr>
		
		<tr>
		  <td align="center">一级产品类别</td>
		  <td align="center"><input type="text" name="productsorta.CName"></td>
		  <td align="center"><input type="text" name="productsorta.CNamee"></td>
		  <td align="center"><input type="text" name="productsorta.CDescription"></td>
		
		</tr>
		 <tr >
	       <td align="center" colspan="4">
             <input type="button" value="保存" id="mybutton" onclick="myajax()" />
              <input type="button" value="取消" id="button" onclick="cancle()" />
	       </td>
         </tr>
		
 </table>
 </form>
 </div>
 
 
 <div style="margin-top:100px;">
 <form id="myform2" method="post" >
 <table id="kk" cellSpacing="0" cellPadding="2"
		width="100%" bgColor="#ffffff" border="2">
 <tr>
		  <th scope="col" abbr="Dual 1.8">添加类型</th>
		  <th scope="col" abbr="Dual 1.8">一级产品名称</th>
		  <th scope="col" abbr="Dual 1.8">产品类别名称</th>
		  <th scope="col" abbr="Dual 1.8">产品类别名称（英文）</th>
		  <th scope="col" abbr="Dual 1.8">描述</th>
 </tr>
		
		<tr>
		 <td align="center">二级级产品类别</td>
		 
		 <td align="center" >
		  <select name="CName" id="CName">
		  <option selected="selected" >${request.ptl.CNameA}</option>
		  <s:iterator value="#request.CPA " var="p">
		     <%-- <option><s:property value="p.CSortaid"/></option> --%>
		     <option >${p.CName}</option>
          </s:iterator>
		  </select>
		  </td>
		 
		  <td align="center"><input type="hidden" name="productsortb.Id" value="${request.ptl.CId}">
		  <input type="text" name="productsortb.CName" value="${request.ptl.CNameB}"></td>
		  <td align="center"><input type="text" name="productsortb.CNamee" value="${request.ptl.CNameeB}"></td>
		  <td align="center"><input type="text" name="productsortb.CDescription" value="${request.ptl.CDescription}"></td>
		</tr>
		
		 <tr>
	       <td align="center" colspan="5">
             <input type="button" value="保存" id="mybutton" onclick="myajax2()" />
             <input type="button" value="取消" id="button" onclick="cancle()" />
	       </td>
         </tr>
 </table>
 </form>
 </div>
 
 
  
  </body>
</html>
